from typing import Optional
from sqlalchemy.orm import Session

from app.dao.model.user import User


def get_user_by_username(db: Session, username: str) -> Optional[User]:
    return db.query(User).filter(User.username == username).first()


def create_root_user(db: Session):
    user = User(
        username="root",
        password="password"
    )

    db.add(user)
    db.commit()
